<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<!-- 求和 -->
		<script type="text/javascript">
			let sum=0;
			let arr = [2,3,4,5]
			arr.forEach(i => {
				sum = sum+i
			})
			console.log(sum)
		</script>
	    
		<script type="text/javascript">
			let arr2 = [4,4,5,6,8,7,6,1,4,7,8,9,1,2,3,1]
			let arr1 = []
			let a=0;
			arr2.forEach(m => {
				m == 4?'没有' : arr1.push(m),
				a=a+m
			})
			console.log(arr1)
			alert(a)
		</script>
		
        <!-- 数组去重 -->
		<script type="text/javascript">
			let r = [0,0,0,0,1,2,3,0,5,6,7,8,0]
			let n = []
			r.forEach(k=> {
				n.indexOf(k) == -1 ? n.push(k):'没有'
			})
			console.log(n)
			
			let arr3 = [1,8,9,4,5,1,2,3,8,9,10]
			let newArr = arr3.filter((g,h,j) =>{
			    return j.indexOf(g) === h;
			})
			console.log(newArr)
		</script>
	</body>
</html>
